package com.itheima.api;

import java.lang.reflect.Array;

public class Demo7 {
    public static void main(String[] args) {
        int[] arr={5,1,3,4,2};
        for (int i = 0; i < arr.length-1; i++) {
            for (int i1 = 0; i1 < arr.length-1-i; i1++) {
                if (arr[i1]>arr[i1+1]){
                    arr[i1]=arr[i1]^arr[i1+1];
                    arr[i1+1]=arr[i1]^arr[i1+1];
                    arr[i1]=arr[i1]^arr[i1+1];
                }
            }
            for (int j = 0; j <arr.length ; j++) {
                System.out.print(arr[j]+" ");

            }
            System.out.println();

        }

    }
}
